<?php
require_once 'duckBehavior/fly.php';
require_once 'duckBehavior/quck.php';
//鸭子类
class Duck {
    //名字
    public $name;
    protected $fly;
    protected $quck;

    public function setFly(Fly $fly)
    {
        $this->fly = $fly;
    }
    public function setQuck(Quck $quck)
    {
        $this->quck = $quck;
    }

    //呱呱叫
    public function qucking()
    {
        if ($this->quck instanceof Quck)
        {
            return $this->quck->qucking();
        }
    }

    //飞
    public function flying()
    {
        if ($this->fly instanceof Fly)
        {
            return $this->fly->flying();
        }
    }
}